# 定义抽象工厂接口
class AbstractFactory:
    def create_phone(self):
        pass

    def create_computer(self):
        pass

# 定义具体工厂1
class AppleFactory(AbstractFactory):
    def create_phone(self):
        return IPhone()

    def create_computer(self):
        return MacBook()

# 定义具体工厂2
class MiFactory(AbstractFactory):
    def create_phone(self):
        return MiPhone()

    def create_computer(self):
        return MiBook()

# 定义抽象产品接口
class Phone:
    def launch(self):
        pass

# 定义具体产品1
class IPhone(Phone):
    def launch(self):
        print("Launching iPhone...")

# 定义具体产品2
class MiPhone(Phone):
    def launch(self):
        print("Launching MiPhone...")

# 定义抽象产品接口
class Computer:
    def launch(self):
        pass

# 定义具体产品1
class MacBook(Computer):
    def launch(self):
        print("Launching MacBook...")

# 定义具体产品2
class MiBook(Computer):
    def launch(self):
        print("Launching MiBook...")

# 定义客户端代码
def client_code(factory):
    phone = factory.create_phone()
    computer = factory.create_computer()
    phone.launch()
    computer.launch()

# 使用具体工厂1
print("Client: Testing the first factory type:")
client_code(AppleFactory())

# 使用具体工厂2
print("Client: Testing the second factory type:")
client_code(MiFactory())